package tasks

import akka.actor.{ActorSystem, Props}

import javax.inject.Inject
import scala.concurrent.ExecutionContext
import com.typesafe.akka.extension.quartz.QuartzSchedulerExtension

import scala.concurrent.duration.DurationInt

class QuartzSchedulerTask@Inject()(
                                    actorSystem: ActorSystem,
//                                    gyQimenService: GyQimenService
                                  )(implicit executionContext: ExecutionContext){

  val someActor = actorSystem.actorOf(Props(new HelloActor))

  //QuartzSchedulerExtension(actorSystem).schedule("cronEveryEvenSecond", cleaner, "2s")

//  QuartzSchedulerExtension(actorSystem).schedule("cronEvery30Seconds",cleaner,"30s")
//  val step = 5
//  actorSystem.scheduler.scheduleAtFixedRate(initialDelay = 10.seconds, interval = step.minute) { () =>
//    // the block of code that will be executed
//    actorSystem.log.info("Executing something...")
//    gyQimenService.gyQimenTask(step)
//  }

//  actorSystem.scheduler.scheduleAtFixedRate(initialDelay = 10.seconds, interval = 1.minute) ({ () =>
//    // the block of code that will be executed
//    actorSystem.log.info("Executing something...")
//  })(executor)
//
//  actorSystem.scheduler.scheduleAtFixedRate(
//    initialDelay = 0.microseconds,
//    interval = 30.seconds,
//    receiver = someActor,
//    message = "tick"
//  )

}

